package test01;

import java.util.TreeSet;

public class Teacher implements Comparable<Teacher>{
    private String tid;
    private String name;
    private TreeSet<Student> tsStudent;

    @Override
    public String toString() {
        return "Teacher{" +
                "tid='" + tid + '\'' +
                ", name='" + name + '\'' +
                ", tsStudent=" + tsStudent +
                '}';
    }

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public TreeSet<Student> getTsStudent() {
        return tsStudent;
    }

    public void setTsStudent(TreeSet<Student> tsStudent) {
        this.tsStudent = tsStudent;
    }

    public Teacher(String tid, String name, TreeSet<Student> tsStudent) {
        this.tid = tid;
        this.name = name;
        this.tsStudent = tsStudent;
    }

    public Teacher() {

    }

    @Override
    public int compareTo(Teacher t) {
        int res = this.getTid().compareTo(t.getTid());
        res = res == 0 ? t.getName().compareTo(this.getName()) : res;
        return res;
    }
}
